home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turn the Power On! 3
/
Turn the Power On! HP Volume III (HP)(1995).ISO
/
install_these
/
install_files
< prev
next >
Wrap
Text File
|
1995-10-03
|
4KB
|
174 lines
#!/bin/ksh
##################################################################
#### Install Runtime Audio and Video components ####
##################################################################
echo ""
if [[ `uname -r` != ?.09.?? ]]
then
echo "ERROR: This script is only appropriate for systems running HP-UX 9.* "
exit 0
fi
if [[ `whoami` != root ]]
then
echo "ERROR: Must be superuser (root) to execute this script."
exit 0
fi
#
# FUNCTION FOR VERIFYING THAT THE ASERVER IS NOT RUNNING
#
# This function is called with the pid of an Aserver process. If the specified
# process is still alive after 4 seconds, returns a "1". If the process dies
# as expected, returns a "0".
function wait_for_death
{
# An Aserver process pid is passed in
target_pid=$1
# Loop here, until the process goes away, or for four seconds
waited=0
until (( waited > 4 ))
do
# Check to see if it's still there. If so, wait one second and try again.
ps -p $target_pid > /dev/null
if [[ $? = "0" ]]
then
sleep 1
((waited = waited + 1 ))
else
return 0
fi
done
return 1
}
#
# FUNCTION FOR KILLING THE ASERVER DAEMON
#
# Kill the fisrt Aserver processes, if the Aserver is running.
# Is the Aserver running? (This also gets the ps-grep string into pid)
function killit
{
pid=$(ps -e | sort | grep $1)
its_alive=$?
while [[ $its_alive = "0" ]]
do
# Remove any leading spaces from string returned by the ps-grep pipe
pid=${pid##*( )}
# and remove everything after the first space
pid=${pid%% *}
# Kill the process
kill $pid
wait_for_death $pid
# If the specified process did not die, kill it harder
if [[ $? = "1" ]]
then
kill -9 $pid
wait_for_death $pid
# If the process is still alive, give up
ps -p $pid > /dev/null
if [[ $? = "0" ]]
then
return 1
fi
fi
# Are there any more processes with the same name?
pid=$(ps -e | sort | grep $1)
its_alive=$?
done
return 0
}
# copy $1 to $2
function copy_file
{
if [[ ! -d $2 ]] ; then exit ; fi
dest_file=$2/$1
if [[ -f $dest_file ]]
then
echo "$dest_file already exists, not overwritten."
else
echo "Copying $1 to $2"
cp $1 $2
chown bin:bin $dest_file
chmod 0555 $dest_file
fi
}
# Install the required video files
echo "INSTALLING VIDEO FILES"
copy_file libvlVideo.sl /usr/lib
copy_file libyuv2.sl /usr/lib
if [[ ! -d /usr/video/bin ]]
then
echo "Creating /usr/video/bin"
mkdir -p /usr/video/bin
chmod a+rx /usr/video /usr/video/bin
fi
copy_file vlServer /usr/video/bin
copy_file raReader /usr/video/bin
# Install the required audio files
echo ""
echo "INSTALLING AUDIO FILES"
if [[ ! -f /usr/audio/bin/asecure ]]
then
echo "Your current version of the Audio Server (Aserver) does not"
echo "support video. This script will load an updated version."
echo "The new version of Aserver includes a security feature"
echo "that prevents remote systems from accessing your audio"
echo "services, unless you grant permission."
echo "Refer to the 'asecure' manpage for information on enabling"
echo "remote audio access.\n"
# Kill the Aserver daemon
killit Aserver
if [[ $? = "1" ]]
then
echo "WARNING: Could not kill the existing Aserver process"
echo " You will need to reboot your system to start the new Aserver"
fi
echo "Moving your current version of the Aserver to /usr/audio/bin/Aserver.orig"
mv /usr/audio/bin/Aserver /usr/audio/bin/Aserver.orig
echo "Copying new Aserver to /usr/audio/bin"
cp Aserver /usr/audio/bin
chown root:sys /usr/audio/bin/Aserver
chmod 4555 /usr/audio/bin/Aserver
copy_file aserver.cat /usr/lib/nls/C
copy_file asecure /usr/audio/bin
copy_file asec.cat /usr/lib/nls/C
copy_file asecure.1m /usr/man/man1m.Z
if [[ -f /usr/audio/.version_srv ]]
then
mv /usr/audio/.version_srv /usr/audio/.version_srv.orig
fi
copy_file .version_srv /usr/audio
echo "Restarting the Aserver"
/usr/audio/bin/Aserver -f
fi
copy_file AudioCP /usr/audio/bin
exit 0